﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

using IronOne.SalesOne.BusinessObjects;
using IronOne.SalesOne.DataObjects;

namespace Facade
{
    [DataObject(true)]
    public class MessageFacade
    {
        LinqMessages linqMessage = new LinqMessages();

        #region Messages
        [DataObjectMethod(DataObjectMethodType.Select)]
        public Message GetMessage(int MessageId)
        {
            return linqMessage.GetMessage(MessageId);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Message> GetMessages(string sortExpression)
        {
            return linqMessage.GetMessages(sortExpression);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Message> GetMessagesSentBy(int userTypeId)
        {
            return linqMessage.GetMessagesSentBy(userTypeId);
        }
        
        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Message> SearchMessages(int UserTypeId, bool broadcasted, int branchId, int unitId, string SOCodeId)
        {
            return linqMessage.SearchMessages(UserTypeId,broadcasted,branchId,unitId,SOCodeId);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Message> SearchMessages(SearchMessage messages)
        {
            return linqMessage.SearchMessages(messages);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Message> SearchMessages(SearchMessage messages,int pageNo,string sortExpression)
        {
            return linqMessage.SearchMessages(messages,pageNo,sortExpression);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Message> GetBroadcastedMessages()
        {
            return linqMessage.GetBroadcastedMessages();
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Message> GetIndividualMessages()
        {
            return linqMessage.GetIndividualMessages();
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Message> GetMessagesToBranches(int branchId)
        {
            return linqMessage.GetMessagesToBranches(branchId);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Message> GetMessagesToUnits(int unitId)
        {
            return linqMessage.GetMessagesToUnits(unitId);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Message> GetMessagesToUnits(string SOCode)
        {
            return linqMessage.GetMeessagesForSOCode(SOCode);
        }

        [DataObjectMethod(DataObjectMethodType.Insert)]
        public void InsertMessage(Message message)
        {
            linqMessage.InsertMessage(message);
        }

        [DataObjectMethod(DataObjectMethodType.Insert)]
        public int InsertMessage(ManageMessages message)
        {
            return linqMessage.InsertMessage(message);
        }

        [DataObjectMethod(DataObjectMethodType.Insert)]
        public void UpdateMessage(ManageMessages message)
        {
            linqMessage.UpdateMessage(message);
        }

        [DataObjectMethod(DataObjectMethodType.Insert)]
        public int UpdateMessage(Message message)
        {
            return linqMessage.UpdateMessage(message);
        }

        [DataObjectMethod(DataObjectMethodType.Insert)]
        public int DeleteMessage(Message message)
        {
            return linqMessage.DeleteMessage(message);
        }

        #endregion


    }
}
